<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="商品评价">
<style>
    .form-horizontal .controls {
        line-height: 40px;
        height: 40px;
        margin-left: 3px;
    }

    .button-primary {
        margin-left: -10px;
    }

    .button-danger {
        margin-left: -25px;
    }
</style>
<!--suppress ALL -->
<form id="searchForm" class="form-panel" action="${basepath}/rest/manage/comment/loadData">
    <ul class="panel-content">
        <li>
            <div class="control-group span5">
                <div class="search-controls  controls">
                    <input type="text" name="productName" id="title" value="" placeholder="搜索关键字">
                </div>
            </div>
            <div class="form-actions span2">
                <button type="submit" class="button  button-primary">
                    搜索
                </button>
            </div>
        </li>
    </ul>
</form>
<div id="grid"></div>
<script>
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {title: '序号', dataIndex: 'id', elCls: 'center', width: '10%'},
                {title: '商品名称', dataIndex: 'productName', elCls: 'center', width: '20%'},
                {title: '商品规格', dataIndex: 'specInfo', elCls: 'center', width: '20%'},
                {title: '评价人', dataIndex: 'userName', elCls: 'center', width: '15%'},
                {title: '评价时间', dataIndex: 'createTime', elCls: 'center', width: '20%'},
                {
                    title: '操作', dataIndex: 'id', elCls: 'center', width: '15%', renderer: function (value) {
                    return '<a href="${basepath}/rest/manage/comment/toEdit?id=' + value + '">查看详情</a>';
                }
                }
            ];

    var store = new Store({
                url: '/rest/manage/comment/loadData',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10'
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',
                totalProperty: 'total'
            }),
            grid = new Grid.Grid({
                render: '#grid',
                width: '100%',
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });
    grid.render();

    //搜索框表单
    var form = new BUI.Form.HForm({
        srcNode: '#searchForm'
    }).render();

    form.on('beforesubmit', function (ev) {
        //序列化成对象
        var obj = form.serializeToObject();
        obj.start = 0; //返回第一页
        store.load(obj);
        return false;
    });
</script>

</@page.pageBase>
